<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <ol id="elem">
      <li>Hello</li>
      <li>World</li>
    </ol>

    <ul>
      <li>li1</li>
      <li>li3</li>
      <li>li4</li>
    </ul>

    <script>
      const elem = document.getElementById("elem");

      function clear(elem) {
        // const lis = elem.querySelectorAll("li");
        // [...lis].forEach((el) => {
        //   el.remove();
        // });
        elem.innerHTML = "";
      }
      clear(elem); // 清除列表
    </script>
  </body>
</html>
